//
//  JwHttpConfig.m
//  JwPack
//
//  Created by 陈警卫 on 2024-08-29.
//

#import "JwHttpConfig.h"
#import "JwHttpManager.h"
#import "JwHttpHandel.h"

kJwHttpHandelKey const kJwHttpOwnerDebugLogKey = @"kJwHttpOwnerDebugLogKey";
kJwHttpHandelKey const kJwHttpOwnerErrorHudKey = @"kJwHttpOwnerErrorHudKey";
kJwHttpHandelKey const kJwHttpOwnerNoLockKey = @"kJwHttpOwnerNoLockKey";

kJwHttpHandelKey const kJwHttpOwnerRefreshHeadersKey = @"kJwHttpOwnerRefreshHeadersKey";
kJwHttpHandelKey const kJwHttpOwnerRefreshParamsKey = @"kJwHttpOwnerRefreshParamsKey";

kJwHttpMethod *kJwHttpMethodDELETE = @"DELETE";
kJwHttpMethod *kJwHttpMethodGET = @"GET";
kJwHttpMethod *kJwHttpMethodHEAD = @"HEAD";
kJwHttpMethod *kJwHttpMethodPATCH = @"PATCH";
kJwHttpMethod *kJwHttpMethodPOST = @"POST";
kJwHttpMethod *kJwHttpMethodPUT = @"PUT";
kJwHttpMethod *kJwHttpMethodQUERY = @"QUERY";

kJwHttpMethod *kJwHttpMethodUPLOAD = @"UPLOAD";
kJwHttpMethod *kJwHttpMethodDOWNLOAD = @"DOWNLOAD";

@implementation JwHttpConfig

- (void)dealloc {
    DLog(@"%@--dealloc", self);
}

+ (JwHttpConfig *)configWithMethod:(kJwHttpMethod *)method
                             point:(nullable NSString *)point
                               url:(nullable NSString *)url
                            params:(nullable NSDictionary *)params
                           headers:(nullable NSDictionary *)headers
                            owners:(nullable NSDictionary *)owners {
    
    JwHttpConfig *config = [[JwHttpConfig alloc] init];
    config.method = method;
    Class class = [JwHttpManager shared].baserClass;
    config.url = [class setupBaseUrlWithPoint:point];
    if (url) {
        config.url = url;
    }
    config.params = [class setupBaseParamsWithParam:params];
    config.headers = [class setupBaseHeadersWithParam:headers];
    config.owners = [class setupBaseOwnersWithParam:owners];
    return config;
}



@end
